home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxcode / ampegsrc / decodsrc / common.c next >
Encoding:
Text File  |  1994-11-11  |  50.1 KB  |  1,675 lines

  1. nstrate the GetImage and PutImage commands }
  2.  
  3. const
  4.   r  = 20;
  5.   StartX = 100;
  6.   StartY = 50;
  7.  
  8. var
  9.   CurPort : ViewPortType;
  10.  
  11. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  12. var
  13.   Step : integer;
  14. begin
  15.   Step := Random(2*r);
  16.   if Odd(Step) then
  17.     Step := -Step;
  18.   X := X + Step;
  19.   Step := Random(r);
  20.   if Odd(Step) then
  21.     Step := -Step;
  22.   Y := Y + Step;
  23.  
  24.   { Make saucer bounce off viewport walls }
  25.   with CurPort do
  26.   begin
  27.     if (x1 + X + Width - 1 > x2) then
  28.       X := x2-x1 - Width + 1
  29.     else
  30.       if (X < 0) then
  31.         X := 0;
  32.     if (y1 + Y + Height - 1 > y2) then
  33.       Y := y2-y1 - Height + 1
  34.     else
  35.       if (Y < 0) then
  36.         Y := 0;
  37.   end;
  38. end; { MoveSaucer }
  39.  
  40. var
  41.   Pausetime : word;
  42.   Saucer    : pointer;
  43.   X, Y      : integer;
  44.   ulx, uly  : word;
  45.   lrx, lry  : word;
  46.   Size      : word;
  47.   I         : word;
  48. begin
  49.   ClearDevice;
  50.   FullPort;
  51.  
  52.   { PaintScreen }
  53.   ClearDevice;
  54.   MainWindow('GetImage / PutImage Demonstration');
  55.   StatusLine('Esc aborts or press a key...');
  56.   GetViewSettings(CurPort);
  57.  
  58.   { DrawSaucer }
  59.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  60.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  61.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  62.   Circle(StartX+10, StartY-12, 2);
  63.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  64.   Circle(StartX-10, StartY-12, 2);
  65.   SetFillStyle(SolidFill, MaxColor);
  66.   FloodFill(StartX+1, StartY+4, GetColor);
  67.  
  68.   { ReadSaucerImage }
  69.   ulx := StartX-(r+1);
  70.   uly := StartY-14;
  71.   lrx := StartX+(r+1);
  72.   lry := StartY+(r div 3)+3;
  73.  
  74.   Size := ImageSize(ulx, uly, lrx, lry);
  75.   GetMem(Saucer, Size);
  76.   GetImage(ulx, uly, lrx, lry, Saucer^);
  77. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  78.  
  79.   { Plot some "stars" }
  80.   for I := 1 to 1000 do
  81.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  82.   X := MaxX div 2;
  83.   Y := MaxY div 2;
  84.   PauseTime := 70;
  85.  
  86.   { Move the saucer around }
  87.   repeat
  88. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  89.      Delay(PauseTime);
  90. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  91.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  92.   until KeyPressed;
  93.   FreeMem(Saucer, size);
  94.   WaitToGo;
  95. end; { PutImagePlay }
  96.  
  97. procedure PolyPlay;
  98. { Draw random polygons with random fill styles on the screen }
  99. const
  100.   MaxPts = 5;
  101. type
  102.   PolygonType = array[1..MaxPts] of PointType;
  103. var
  104.   Poly : PolygonType;
  105.   I, Color : word;
  106. begin
  107.   MainWindow('FillPoly demonstration');
  108.   StatusLine('Esc aborts or press a key...');
  109.   repeat
  110.     Color := RandColor;
  111.     SetFillStyle(Random(11)+1, Color);
  112.     SetColor(Color);
  113.     for I := 1 to MaxPts do
  114.       with Poly[I] do
  115.       begin
  116.         X := Random(MaxX);
  117.         Y := Random(MaxY);
  118.       end;
  119.     FillPoly(MaxPts, Poly);
  120.   until KeyPressed;
  121.   WaitToGo;
  122. end; { PolyPlay }
  123.  
  124. procedure FillStylePlay;
  125. { Display all of the predefined fill styles available }
  126. var
  127.   Style    : word;
  128.   Width    : word;
  129.   Height   : word;
  130.   X, Y     : word;
  131.   I, J     : word;
  132.   ViewInfo : ViewPortType;
  133.  
  134. procedure DrawBox(X, Y : word);
  135. begin
  136.   SetFillStyle(Style, MaxColor);
  137.   with ViewInfo do
  138.     Bar(X, Y, X+Width, Y+Height);
  139.   Rectangle(X, Y, X+Width, Y+Height);
  140.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  141.   Inc(Style);
  142. end; { DrawBox }
  143.  
  144. begin
  145.   MainWindow('Pre-defined fill styles');
  146.   GetViewSettings(ViewInfo);
  147.   with ViewInfo do
  148.   begin
  149.     Width := 2 * ((x2+1) div 13);
  150.     Height := 2 * ((y2-10) div 10);
  151.   end;
  152.   X := Width div 2;
  153.   Y := Height div 2;
  154.   Style := 0;
  155.   for J := 1 to 3 do
  156.   begin
  157.     for I := 1 to 4 do
  158.     begin
  159.       DrawBox(X, Y);
  160.       Inc(X, (Width div 2) * 3);
  161.     end;
  162.     X := Width div 2;
  163.     Inc(Y, (Height div 2) * 3);
  164.   end;
  165.   SetTextJustify(LeftText, TopText);
  166.   WaitToGo;
  167. end; { FillStylePlay }
  168.  
  169. procedure FillPatternPlay;
  170. { Display some user defined fill patterns }
  171. const
  172.   Patterns : array[0..11] of FillPatternType = (
  173.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  174.             OldColor which has a path of pixels of OldColor or NewColor
  175.             with sides touching back to the seed point, (XSeed, YSeed).
  176.             Therefore, only pixels of OldColor are modified and no other
  177.             information is changed.
  178.  
  179.             SEE ALSO
  180.  
  181.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  182.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  183.             SETVIEW
  184.  
  185.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  186.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  187.             IF WHICHVGA = 0 THEN STOP
  188.             DUMMY=RES640
  189.             SETVIEW 100, 100, 539, 379
  190.             FILLVIEW 10
  191.             WHILE INKEY$ = ""
  192.             WEND
  193.             VIDEOMODESET VMODE
  194.             END
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.                                                                          63
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.           FONTGETINFO
  219.  
  220.             PROTOTYPE
  221.  
  222.             SUB FONTGETINFO (Width%, Height%)
  223.  
  224.             INPUT
  225.  
  226.             no input parameters
  227.     WEND
  228.             MOUSEEXIT
  229.             VIDEOMODESET VMODE
  230.             END
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                                                                          86
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.           MOUSECURSORDEFAULT
  279.  
  280.             PROTOTYPE
  281.  
  282.             SUB MOUSECURSORDEFAULT ()
  283.  
  284.             INPUT
  285.  
  286.             no input parameters
  287.  
  288.             OUTPUT
  289.  
  290.             no value returned
  291.  
  292.             USAGE
  293.  
  294.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  295.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  296. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  297. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  298. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  299. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  300. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  301. $╤
  302. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  303. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  304. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  305. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  306. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  307. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  308. ░£▒
  309. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  310. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  311.       end;
  312.     end;
  313.   end;
  314.   WaitToGo;
  315. end; { UserLineStylePlay }
  316.  
  317.  
  318. procedure SayGoodbye;
  319. { Say goodbye and then exit the program }
  320. var
  321.   ViewInfo : ViewPortType;
  322. begin
  323.   MainWindow('');
  324.   GetViewSettings(ViewInfo);
  325.   SetTextStyle(TriplexFont, HorizDir, 4);
  326.   SetTextJustify(CenterText, CenterText);
  327.   with ViewInfo do
  328.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  329.   StatusLine('Press any key to quit...');
  330.   repeat until KeyPressed;
  331. end; { SayGoodbye }
  332.  
  333.  
  334. PROCEDURE SelectMode;
  335. VAR
  336.     choice1,choice2     : CHAR;
  337.    xsize,ysize            : WORD;
  338. BEGIN
  339.     (* Let's select a mode *)
  340.     ClrScr;
  341.     WriteLn('VESADEMO:');
  342.     WriteLn('1. 256 colors');
  343.     WriteLn('2. 32768 colors');
  344.     WriteLn('3. 65536 colors');
  345.     WriteLn('4. 16777216 colors');
  346.     WriteLn('Q uit');
  347.     WriteLn;
  348.     Write('Your choice: ');
  349.     REPEAT
  350.         ReadLn(choice1);
  351.       IF choice1 <> '1' THEN BEGIN
  352.           WriteLn('Sorry !');
  353.          WriteLn('This demo wasn''t written for more as 256 colors !');
  354.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  355.          WriteLn('Switching to 256 colors.');
  356.          choice1 := '1';
  357.       END;
  358.     UNTIL choice1 IN ['1'..'4','q'];
  359.     IF choice1 = 'q' THEN Halt;
  360.  
  361.     WriteLn;
  362.     WriteLn;
  363.     WriteLn('a. 320x200');
  364.     WriteLn('b. 640x480');
  365.     WriteLn('c. 800x600');
  366.     WriteLn('d. 1024x768');
  367.     WriteLn('e. 1280x1024');
  368.     WriteLn('Q uit');
  369.     WriteLn;
  370.     Write('Your choice: ');
  371.     REPEAT
  372.         ReadLn(choice2);
  373.     UNTIL choice2 IN ['a'..'e','q'];
  374.     IF choice2 = 'q' THEN Halt;
  375.  
  376.     CASE choice2 OF
  377.         'a' : BEGIN
  378.             xsize := 320;
  379.             ysize := 200;
  380.         END;
  381.         'b' : BEGIN
  382.             xsize := 640;
  383.             ysize := 480;
  384.         END;
  385.         'c' : BEGIN
  386.             xsize := 800;
  387.             ysize := 600;
  388.         END;
  389.         'd' : BEGIN
  390.             xsize := 1024;
  391.             ysize := 768;
  392.         END;
  393.         'e' : BEGIN
  394.             xsize := 1280;
  395.             ysize := 1024;
  396.         END;
  397.     END;
  398.     CASE choice1 OF
  399.         '1' : mode := FindVesaMode(xsize,ysize,8);
  400.         '2' : mode := FindVesaMode(xsize,ysize,15);
  401.         '3' : mode := FindVesaMode(xsize,ysize,16);
  402.         '4' : mode := FindVesaMode(xsize,ysize,24);
  403.     END;
  404.     IF mode = 0 THEN BEGIN
  405.         WriteLn('No such mode could be found !');
  406.         WriteLn('Switching to to 320x200.');
  407.         ReadKey;
  408.         mode := V320x200x256;
  409.     END;
  410. END;
  411.  
  412. begin { program body }
  413.   SelectMode;
  414.   Initialize;
  415.   ReportStatus;
  416.  
  417. {  AspectRatioPlay; }
  418.   FillEllipsePlay;
  419.   SectorPlay;
  420.   WriteModePlay;
  421.  
  422.   ColorPlay;
  423.   { PalettePlay only intended to work on these drivers: }
  424.   if (GraphDriver = EGA) or
  425.       (GraphDriver = EGA64) or
  426.       (GraphDriver = VGA) then
  427.      PalettePlay;
  428.   PutPixelPlay;
  429. {  PutImagePlay; }
  430.   RandBarPlay;
  431.   BarPlay;
  432.   Bar3DPlay;
  433.   ArcPlay;
  434.   CirclePlay;
  435.   PiePlay;
  436.   LineToPlay;
  437.   LineRelPlay;
  438. {  LineStylePlay; }
  439. {  UserLineStylePlay; }
  440.   TextDump;
  441.   TextPlay;
  442.   CrtModePlay;
  443.   FillStylePlay;
  444.   FillPatternPlay;
  445.   PolyPlay;
  446.   SayGoodbye;
  447. {  CloseGraph; }
  448.   CloseVesa;
  449. end.
  450. ***************************************************
  451.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  452.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  453. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  454. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  455. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  456. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  457.     Color := RandColor;
  458.     SetColor(Color);
  459.     SetFillStyle(Random(CloseDotFill)+1, Color);
  460.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  461.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  462.   until KeyPressed;
  463.   WaitToGo;
  464. end; { RandBarPlay }
  465.  
  466. procedure ArcPlay;
  467. { Draw random arcs on the screen }
  468. var
  469.   MaxRadius : word;
  470.   EndAngle : word;
  471.   ArcInfo : ArcCoordsType;
  472. begin
  473.   MainWindow('Arc / GetArcCoords demonstration');
  474.   StatusLine('Esc aborts or press a key');
  475.   MaxRadius := MaxY div 10;
  476.   repeat
  477.     SetColor(RandColor);
  478.     EndAngle := Random(360);
  479.     SetLineStyle(SolidLn, 0, NormWidth);
  480.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  481.     GetArcCoords(ArcInfo);
  482.     with ArcInfo do
  483.     begin
  484.       Line(X, Y, XStart, YStart);
  485.       Line(X, Y, Xend, Yend);
  486.     end;
  487.   until KeyPressed;
  488.   WaitToGo;
  489. end; { ArcPlay }
  490.  
  491. procedure PutPixelPlay;
  492. { Demonstrate the PutPixel and GetPixel commands }
  493. const
  494.   Seed   = 1962; { A seed for the random number generator }
  495.   NumPts = 2000; { The number of pixels plotted }
  496.   Esc    = #27;
  497. var
  498.   I : word;
  499.   X, Y, Color : word;
  500.   XMax, YMax  : integer;
  501.   ViewInfo    : ViewPortType;
  502. begin
  503.   MainWindow('PutPixel / GetPixel demonstration');
  504.   StatusLine('Esc aborts or press a key...');
  505.  
  506.   GetViewSettings(ViewInfo);
  507.   with ViewInfo do
  508.   begin
  509.     XMax := (x2-x1-1);
  510.     YMax := (y2-y1-1);
  511.   end;
  512.  
  513.   while not KeyPressed do
  514.   begin
  515.     { Plot random pixels }
  516.     RandSeed := Seed;
  517.     I := 0;
  518.     while (not KeyPressed) and (I < NumPts) do
  519.     begin
  520.       Inc(I);
  521.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  522.     end;
  523.  
  524.     { Erase pixels }
  525.     RandSeed := Seed;
  526.     I := 0;
  527.     while (not KeyPressed) and (I < NumPts) do
  528.     begin
  529.       Inc(I);
  530.       X := Random(XMax)+1;
  531.       Y := Random(YMax)+1;
  532.       Color := GetPixel(X, Y);
  533.         if Color = RandColor then
  534.           PutPixel(X, Y, 0);
  535.      end;
  536.   end;
  537.   WaitToGo;
  538. end; { PutPixelPlay }
  539.  
  540. procedure PutImagePlay;
  541. { Demonstrate the GetImage and PutImage commands }
  542.  
  543. const
  544.   r  = 20;
  545.   StartX = 100;
  546.   StartY = 50;
  547.  
  548. var
  549.   CurPort : ViewPortType;
  550.  
  551. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  552. var
  553.   Step : integer;
  554. begin
  555.   Step := Random(2*r);
  556.   if Odd(Step) then
  557.     Step := -Step;
  558.   X := X + Step;
  559.   Step := Random(r);
  560.   if Odd(Step) then
  561.     Step := -Step;
  562.   Y := Y + Step;
  563.  
  564.   { Make saucer bounce off viewport walls }
  565.   with CurPort do
  566.   begin
  567.     if (x1 + X + Width - 1 > x2) then
  568.       X := x2-x1 - Width + 1
  569.     else
  570.       if (X < 0) then
  571.         X := 0;
  572.     if (y1 + Y + Height - 1 > y2) then
  573.       Y := y2-y1 - Height + 1
  574.     else
  575.       if (Y < 0) then
  576.         Y := 0;
  577.   end;
  578. end; { MoveSaucer }
  579.  
  580. var
  581.   Pausetime : word;
  582.   Saucer    : pointer;
  583.   X, Y      : integer;
  584.   ulx, uly  : word;
  585.   lrx, lry  : word;
  586.   Size      : word;
  587.   I         : word;
  588. begin
  589.   ClearDevice;
  590.   FullPort;
  591.  
  592.   { PaintScreen }
  593.   ClearDevice;
  594.   MainWindow('GetImage / PutImage Demonstration');
  595.   StatusLine('Esc aborts or press a key...');
  596.   GetViewSettings(CurPort);
  597.  
  598.   { DrawSaucer }
  599.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  600.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  601.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  602.   Circle(StartX+10, StartY-12, 2);
  603.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  604.   Circle(StartX-10, StartY-12, 2);
  605.   SetFillStyle(SolidFill, MaxColor);
  606.   FloodFill(StartX+1, StartY+4, GetColor);
  607.  
  608.   { ReadSaucerImage }
  609.   ulx := StartX-(r+1);
  610.   uly := StartY-14;
  611.   lrx := StartX+(r+1);
  612.   lry := StartY+(r div 3)+3;
  613.  
  614.   Size := ImageSize(ulx, uly, lrx, lry);
  615.   GetMem(Saucer, Size);
  616.   GetImage(ulx, uly, lrx, lry, Saucer^);
  617. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  618.  
  619.   { Plot some "stars" }
  620.   for I := 1 to 1000 do
  621.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  622.   X := MaxX div 2;
  623.   Y := MaxY div 2;
  624.   PauseTime := 70;
  625.  
  626.   { Move the saucer around }
  627.   repeat
  628. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  629.      Delay(PauseTime);
  630. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  631.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  632.   until KeyPressed;
  633.   FreeMem(Saucer, size);
  634.   WaitToGo;
  635. end; { PutImagePlay }
  636.  
  637. procedure PolyPlay;
  638. { Draw random polygons with random fill styles on the screen }
  639. const
  640.   MaxPts = 5;
  641. type
  642.   PolygonType = array[1..MaxPts] of PointType;
  643. var
  644.   Poly : PolygonType;
  645.   I, Color : word;
  646. begin
  647.   MainWindow('FillPoly demonstration');
  648.   StatusLine('Esc aborts or press a key...');
  649.   repeat
  650.     Color := RandColor;
  651.     SetFillStyle(Random(11)+1, Color);
  652.     SetColor(Color);
  653.     for I := 1 to MaxPts do
  654.       with Poly[I] do
  655.       begin
  656.         X := Random(MaxX);
  657.         Y := Random(MaxY);
  658.       end;
  659.     FillPoly(MaxPts, Poly);
  660.   until KeyPressed;
  661.   WaitToGo;
  662. end; { PolyPlay }
  663.  
  664. procedure FillStylePlay;
  665. { Display all of the predefined fill styles available }
  666. var
  667.   Style    : word;
  668.   Width    : word;
  669.   Height   : word;
  670.   X, Y     : word;
  671.   I, J     : word;
  672.   ViewInfo : ViewPortType;
  673.  
  674. procedure DrawBox(X, Y : word);
  675. begin
  676.   SetFillStyle(Style, MaxColor);
  677.   with ViewInfo do
  678.     Bar(X, Y, X+Width, Y+Height);
  679.   Rectangle(X, Y, X+Width, Y+Height);
  680.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  681.   Inc(Style);
  682. end; { DrawBox }
  683.  
  684. begin
  685.   MainWindow('Pre-defined fill styles');
  686.   GetViewSettings(ViewInfo);
  687.   with ViewInfo do
  688.   begin
  689.     Width := 2 * ((x2+1) div 13);
  690.     Height := 2 * ((y2-10) div 10);
  691.   end;
  692.   X := Width div 2;
  693.   Y := Height div 2;
  694.   Style := 0;
  695.   for J := 1 to 3 do
  696.   begin
  697.     for I := 1 to 4 do
  698.     begin
  699.       DrawBox(X, Y);
  700.       Inc(X, (Width div 2) * 3);
  701.     end;
  702.     X := Width div 2;
  703.     Inc(Y, (Height div 2) * 3);
  704.   end;
  705.   SetTextJustify(LeftText, TopText);
  706.   WaitToGo;
  707. end; { FillStylePlay }
  708.  
  709. procedure FillPatternPlay;
  710. { Display some user defined fill patterns }
  711. const
  712.   Patterns : array[0..11] of FillPatternType = (
  713.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  714.             OldColor which has a path of pixels of OldColor or NewColor
  715.             with sides touching back to the seed point, (XSeed, YSeed).
  716.             Therefore, only pixels of OldColor are modified and no other
  717.             information is changed.
  718.  
  719.             SEE ALSO
  720.  
  721.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  722.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  723.             SETVIEW
  724.  
  725.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  726.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  727.             IF WHICHVGA = 0 THEN STOP
  728.             DUMMY=RES640
  729.             SETVIEW 100, 100, 539, 379
  730.             FILLVIEW 10
  731.             WHILE INKEY$ = ""
  732.             WEND
  733.             VIDEOMODESET VMODE
  734.             END
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.                                                                          63
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.           FONTGETINFO
  759.  
  760.             PROTOTYPE
  761.  
  762.             SUB FONTGETINFO (Width%, Height%)
  763.  
  764.             INPUT
  765.  
  766.             no input parameters
  767.     WEND
  768.             MOUSEEXIT
  769.             VIDEOMODESET VMODE
  770.             END
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.                                                                          86
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.           MOUSECURSORDEFAULT
  819.  
  820.             PROTOTYPE
  821.  
  822.             SUB MOUSECURSORDEFAULT ()
  823.  
  824.             INPUT
  825.  
  826.             no input parameters
  827.  
  828.             OUTPUT
  829.  
  830.             no value returned
  831.  
  832.             USAGE
  833.  
  834.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  835.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  836. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  837. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  838. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  839. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  840. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  841. $╤
  842. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  843. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  844. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  845. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  846. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  847. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  848. ░£▒
  849. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  850. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  851.       end;
  852.     end;
  853.   end;
  854.   WaitToGo;
  855. end; { UserLineStylePlay }
  856.  
  857.  
  858. procedure SayGoodbye;
  859. { Say goodbye and then exit the program }
  860. var
  861.   ViewInfo : ViewPortType;
  862. begin
  863.   MainWindow('');
  864.   GetViewSettings(ViewInfo);
  865.   SetTextStyle(TriplexFont, HorizDir, 4);
  866.   SetTextJustify(CenterText, CenterText);
  867.   with ViewInfo do
  868.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  869.   StatusLine('Press any key to quit...');
  870.   repeat until KeyPressed;
  871. end; { SayGoodbye }
  872.  
  873.  
  874. PROCEDURE SelectMode;
  875. VAR
  876.     choice1,choice2     : CHAR;
  877.    xsize,ysize            : WORD;
  878. BEGIN
  879.     (* Let's select a mode *)
  880.     ClrScr;
  881.     WriteLn('VESADEMO:');
  882.     WriteLn('1. 256 colors');
  883.     WriteLn('2. 32768 colors');
  884.     WriteLn('3. 65536 colors');
  885.     WriteLn('4. 16777216 colors');
  886.     WriteLn('Q uit');
  887.     WriteLn;
  888.     Write('Your choice: ');
  889.     REPEAT
  890.         ReadLn(choice1);
  891.       IF choice1 <> '1' THEN BEGIN
  892.           WriteLn('Sorry !');
  893.          WriteLn('This demo wasn''t written for more as 256 colors !');
  894.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  895.          WriteLn('Switching to 256 colors.');
  896.          choice1 := '1';
  897.       END;
  898.     UNTIL choice1 IN ['1'..'4','q'];
  899.     IF choice1 = 'q' THEN Halt;
  900.  
  901.     WriteLn;
  902.     WriteLn;
  903.     WriteLn('a. 320x200');
  904.     WriteLn('b. 640x480');
  905.     WriteLn('c. 800x600');
  906.     WriteLn('d. 1024x768');
  907.     WriteLn('e. 1280x1024');
  908.     WriteLn('Q uit');
  909.     WriteLn;
  910.     Write('Your choice: ');
  911.     REPEAT
  912.         ReadLn(choice2);
  913.     UNTIL choice2 IN ['a'..'e','q'];
  914.     IF choice2 = 'q' THEN Halt;
  915.  
  916.     CASE choice2 OF
  917.         'a' : BEGIN
  918.             xsize := 320;
  919.             ysize := 200;
  920.         END;
  921.         'b' : BEGIN
  922.             xsize := 640;
  923.             ysize := 480;
  924.         END;
  925.         'c' : BEGIN
  926.             xsize := 800;
  927.             ysize := 600;
  928.         END;
  929.         'd' : BEGIN
  930.             xsize := 1024;
  931.             ysize := 768;
  932.         END;
  933.         'e' : BEGIN
  934.             xsize := 1280;
  935.             ysize := 1024;
  936.         END;
  937.     END;
  938.     CASE choice1 OF
  939.         '1' : mode := FindVesaMode(xsize,ysize,8);
  940.         '2' : mode := FindVesaMode(xsize,ysize,15);
  941.         '3' : mode := FindVesaMode(xsize,ysize,16);
  942.         '4' : mode := FindVesaMode(xsize,ysize,24);
  943.     END;
  944.     IF mode = 0 THEN BEGIN
  945.         WriteLn('No such mode could be found !');
  946.         WriteLn('Switching to to 320x200.');
  947.         ReadKey;
  948.         mode := V320x200x256;
  949.     END;
  950. END;
  951.  
  952. begin { program body }
  953.   SelectMode;
  954.   Initialize;
  955.   ReportStatus;
  956.  
  957. {  AspectRatioPlay; }
  958.   FillEllipsePlay;
  959.   SectorPlay;
  960.   WriteModePlay;
  961.  
  962.   ColorPlay;
  963.   { PalettePlay only intended to work on these drivers: }
  964.   if (GraphDriver = EGA) or
  965.       (GraphDriver = EGA64) or
  966.       (GraphDriver = VGA) then
  967.      PalettePlay;
  968.   PutPixelPlay;
  969. {  PutImagePlay; }
  970.   RandBarPlay;
  971.   BarPlay;
  972.   Bar3DPlay;
  973.   ArcPlay;
  974.   CirclePlay;
  975.   PiePlay;
  976.   LineToPlay;
  977.   LineRelPlay;
  978. {  LineStylePlay; }
  979. {  UserLineStylePlay; }
  980.   TextDump;
  981.   TextPlay;
  982.   CrtModePlay;
  983.   FillStylePlay;
  984.   FillPatternPlay;
  985.   PolyPlay;
  986.   SayGoodbye;
  987. {  CloseGraph; }
  988.   CloseVesa;
  989. end.
  990. ***************************************************
  991.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  992.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  993. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  994. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  995. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  996. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  997.     Color := RandColor;
  998.     SetColor(Color);
  999.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1000.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1001.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1002.   until KeyPressed;
  1003.   WaitToGo;
  1004. end; { RandBarPlay }
  1005.  
  1006. procedure ArcPlay;
  1007. { Draw random arcs on the screen }
  1008. var
  1009.   MaxRadius : word;
  1010.   EndAngle : word;
  1011.   ArcInfo : ArcCoordsType;
  1012. begin
  1013.   MainWindow('Arc / GetArcCoords demonstration');
  1014.   StatusLine('Esc aborts or press a key');
  1015.   MaxRadius := MaxY div 10;
  1016.   repeat
  1017.     SetColor(RandColor);
  1018.     EndAngle := Random(360);
  1019.     SetLineStyle(SolidLn, 0, NormWidth);
  1020.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1021.     GetArcCoords(ArcInfo);
  1022.     with ArcInfo do
  1023.     begin
  1024.       Line(X, Y, XStart, YStart);
  1025.       Line(X, Y, Xend, Yend);
  1026.     end;
  1027.   until KeyPressed;
  1028.   WaitToGo;
  1029. end; { ArcPlay }
  1030.  
  1031. procedure PutPixelPlay;
  1032. { Demonstrate the PutPixel and GetPixel commands }
  1033. const
  1034.   Seed   = 1962; { A seed for the random number generator }
  1035.   NumPts = 2000; { The number of pixels plotted }
  1036.   Esc    = #27;
  1037. var
  1038.   I : word;
  1039.   X, Y, Color : word;
  1040.   XMax, YMax  : integer;
  1041.   ViewInfo    : ViewPortType;
  1042. begin
  1043.   MainWindow('PutPixel / GetPixel demonstration');
  1044.   StatusLine('Esc aborts or press a key...');
  1045.  
  1046.   GetViewSettings(ViewInfo);
  1047.   with ViewInfo do
  1048.   begin
  1049.     XMax := (x2-x1-1);
  1050.     YMax := (y2-y1-1);
  1051.   end;
  1052.  
  1053.   while not KeyPressed do
  1054.   begin
  1055.     { Plot random pixels }
  1056.     RandSeed := Seed;
  1057.     I := 0;
  1058.     while (not KeyPressed) and (I < NumPts) do
  1059.     begin
  1060.       Inc(I);
  1061.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1062.     end;
  1063.  
  1064.     { Erase pixels }
  1065.     RandSeed := Seed;
  1066.     I := 0;
  1067.     while (not KeyPressed) and (I < NumPts) do
  1068.     begin
  1069.       Inc(I);
  1070.       X := Random(XMax)+1;
  1071.       Y := Random(YMax)+1;
  1072.       Color := GetPixel(X, Y);
  1073.         if Color = RandColor then
  1074.           PutPixel(X, Y, 0);
  1075.      end;
  1076.   end;
  1077.   WaitToGo;
  1078. end; { PutPixelPlay }
  1079.  
  1080. procedure PutImagePlay;
  1081. { Demonstrate the GetImage and PutImage commands }
  1082.  
  1083. const
  1084.   r  = 20;
  1085.   StartX = 100;
  1086.   StartY = 50;
  1087.  
  1088. var
  1089.   CurPort : ViewPortType;
  1090.  
  1091. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1092. var
  1093.   Step : integer;
  1094. begin
  1095.   Step := Random(2*r);
  1096.   if Odd(Step) then
  1097.     Step := -Step;
  1098.   X := X + Step;
  1099.   Step := Random(r);
  1100.   if Odd(Step) then
  1101.     Step := -Step;
  1102.   Y := Y + Step;
  1103.  
  1104.   { Make saucer bounce off viewport walls }
  1105.   with CurPort do
  1106.   begin
  1107.     if (x1 + X + Width - 1 > x2) then
  1108.       X := x2-x1 - Width + 1
  1109.     else
  1110.       if (X < 0) then
  1111.         X := 0;
  1112.     if (y1 + Y + Height - 1 > y2) then
  1113.       Y := y2-y1 - Height + 1
  1114.     else
  1115.       if (Y < 0) then
  1116.         Y := 0;
  1117.   end;
  1118. end; { MoveSaucer }
  1119.  
  1120. var
  1121.   Pausetime : word;
  1122.   Saucer    : pointer;
  1123.   X, Y      : integer;
  1124.   ulx, uly  : word;
  1125.   lrx, lry  : word;
  1126.   Size      : word;
  1127.   I         : word;
  1128. begin
  1129.   ClearDevice;
  1130.   FullPort;
  1131.  
  1132.   { PaintScreen }
  1133.   ClearDevice;
  1134.   MainWindow('GetImage / PutImage Demonstration');
  1135.   StatusLine('Esc aborts or press a key...');
  1136.   GetViewSettings(CurPort);
  1137.  
  1138.   { DrawSaucer }
  1139.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1140.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1141.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1142.   Circle(StartX+10, StartY-12, 2);
  1143.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1144.   Circle(StartX-10, StartY-12, 2);
  1145.   SetFillStyle(SolidFill, MaxColor);
  1146.   FloodFill(StartX+1, StartY+4, GetColor);
  1147.  
  1148.   { ReadSaucerImage }
  1149.   ulx := StartX-(r+1);
  1150.   uly := StartY-14;
  1151.   lrx := StartX+(r+1);
  1152.   lry := StartY+(r div 3)+3;
  1153.  
  1154.   Size := ImageSize(ulx, uly, lrx, lry);
  1155.   GetMem(Saucer, Size);
  1156.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1157. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1158.  
  1159.   { Plot some "stars" }
  1160.   for I := 1 to 1000 do
  1161.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1162.   X := MaxX div 2;
  1163.   Y := MaxY div 2;
  1164.   PauseTime := 70;
  1165.  
  1166.   { Move the saucer around }
  1167.   repeat
  1168. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1169.      Delay(PauseTime);
  1170. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1171.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1172.   until KeyPressed;
  1173.   FreeMem(Saucer, size);
  1174.   WaitToGo;
  1175. end; { PutImagePlay }
  1176.  
  1177. procedure PolyPlay;
  1178. { Draw random polygons with random fill styles on the screen }
  1179. const
  1180.   MaxPts = 5;
  1181. type
  1182.   PolygonType = array[1..MaxPts] of PointType;
  1183. var
  1184.   Poly : PolygonType;
  1185.   I, Color : word;
  1186. begin
  1187.   MainWindow('FillPoly demonstration');
  1188.   StatusLine('Esc aborts or press a key...');
  1189.   repeat
  1190.     Color := RandColor;
  1191.     SetFillStyle(Random(11)+1, Color);
  1192.     SetColor(Color);
  1193.     for I := 1 to MaxPts do
  1194.       with Poly[I] do
  1195.       begin
  1196.         X := Random(MaxX);
  1197.         Y := Random(MaxY);
  1198.       end;
  1199.     FillPoly(MaxPts, Poly);
  1200.   until KeyPressed;
  1201.   WaitToGo;
  1202. end; { PolyPlay }
  1203.  
  1204. procedure FillStylePlay;
  1205. { Display all of the predefined fill styles available }
  1206. var
  1207.   Style    : word;
  1208.   Width    : word;
  1209.   Height   : word;
  1210.   X, Y     : word;
  1211.   I, J     : word;
  1212.   ViewInfo : ViewPortType;
  1213.  
  1214. procedure DrawBox(X, Y : word);
  1215. begin
  1216.   SetFillStyle(Style, MaxColor);
  1217.   with ViewInfo do
  1218.     Bar(X, Y, X+Width, Y+Height);
  1219.   Rectangle(X, Y, X+Width, Y+Height);
  1220.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1221.   Inc(Style);
  1222. end; { DrawBox }
  1223.  
  1224. begin
  1225.   MainWindow('Pre-defined fill styles');
  1226.   GetViewSettings(ViewInfo);
  1227.   with ViewInfo do
  1228.   begin
  1229.     Width := 2 * ((x2+1) div 13);
  1230.     Height := 2 * ((y2-10) div 10);
  1231.   end;
  1232.   X := Width div 2;
  1233.   Y := Height div 2;
  1234.   Style := 0;
  1235.   for J := 1 to 3 do
  1236.   begin
  1237.     for I := 1 to 4 do
  1238.     begin
  1239.       DrawBox(X, Y);
  1240.       Inc(X, (Width div 2) * 3);
  1241.     end;
  1242.     X := Width div 2;
  1243.     Inc(Y, (Height div 2) * 3);
  1244.   end;
  1245.   SetTextJustify(LeftText, TopText);
  1246.   WaitToGo;
  1247. end; { FillStylePlay }
  1248.  
  1249. procedure FillPatternPlay;
  1250. { Display some user defined fill patterns }
  1251. const
  1252.   Patterns : array[0..11] of FillPatternType = (
  1253.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1254.             OldColor which has a path of pixels of OldColor or NewColor
  1255.             with sides touching back to the seed point, (XSeed, YSeed).
  1256.             Therefore, only pixels of OldColor are modified and no other
  1257.             information is changed.
  1258.  
  1259.             SEE ALSO
  1260.  
  1261.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1262.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1263.             SETVIEW
  1264.  
  1265.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1266.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1267.             IF WHICHVGA = 0 THEN STOP
  1268.             DUMMY=RES640
  1269.             SETVIEW 100, 100, 539, 379
  1270.             FILLVIEW 10
  1271.             WHILE INKEY$ = ""
  1272.             WEND
  1273.             VIDEOMODESET VMODE
  1274.             END
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.                                                                          63
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.           FONTGETINFO
  1299.  
  1300.             PROTOTYPE
  1301.  
  1302.             SUB FONTGETINFO (Width%, Height%)
  1303.  
  1304.             INPUT
  1305.  
  1306.             no input parameters
  1307.     WEND
  1308.             MOUSEEXIT
  1309.             VIDEOMODESET VMODE
  1310.             END
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.                                                                          86
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.           MOUSECURSORDEFAULT
  1359.  
  1360.             PROTOTYPE
  1361.  
  1362.             SUB MOUSECURSORDEFAULT ()
  1363.  
  1364.             INPUT
  1365.  
  1366.             no input parameters
  1367.  
  1368.             OUTPUT
  1369.  
  1370.             no value returned
  1371.  
  1372.             USAGE
  1373.  
  1374.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1375.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  1376. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1377. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  1378. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1379. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1380. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1381. $╤
  1382. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  1383. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  1384. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1385. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1386. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  1387. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  1388. ░£▒
  1389. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  1390. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1391.       end;
  1392.     end;
  1393.   end;
  1394.   WaitToGo;
  1395. end; { UserLineStylePlay }
  1396.  
  1397.  
  1398. procedure SayGoodbye;
  1399. { Say goodbye and then exit the program }
  1400. var
  1401.   ViewInfo : ViewPortType;
  1402. begin
  1403.   MainWindow('');
  1404.   GetViewSettings(ViewInfo);
  1405.   SetTextStyle(TriplexFont, HorizDir, 4);
  1406.   SetTextJustify(CenterText, CenterText);
  1407.   with ViewInfo do
  1408.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1409.   StatusLine('Press any key to quit...');
  1410.   repeat until KeyPressed;
  1411. end; { SayGoodbye }
  1412.  
  1413.  
  1414. PROCEDURE SelectMode;
  1415. VAR
  1416.     choice1,choice2     : CHAR;
  1417.    xsize,ysize            : WORD;
  1418. BEGIN
  1419.     (* Let's select a mode *)
  1420.     ClrScr;
  1421.     WriteLn('VESADEMO:');
  1422.     WriteLn('1. 256 colors');
  1423.     WriteLn('2. 32768 colors');
  1424.     WriteLn('3. 65536 colors');
  1425.     WriteLn('4. 16777216 colors');
  1426.     WriteLn('Q uit');
  1427.     WriteLn;
  1428.     Write('Your choice: ');
  1429.     REPEAT
  1430.         ReadLn(choice1);
  1431.       IF choice1 <> '1' THEN BEGIN
  1432.           WriteLn('Sorry !');
  1433.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1434.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1435.          WriteLn('Switching to 256 colors.');
  1436.          choice1 := '1';
  1437.       END;
  1438.     UNTIL choice1 IN ['1'..'4','q'];
  1439.     IF choice1 = 'q' THEN Halt;
  1440.  
  1441.     WriteLn;
  1442.     WriteLn;
  1443.     WriteLn('a. 320x200');
  1444.     WriteLn('b. 640x480');
  1445.     WriteLn('c. 800x600');
  1446.     WriteLn('d. 1024x768');
  1447.     WriteLn('e. 1280x1024');
  1448.     WriteLn('Q uit');
  1449.     WriteLn;
  1450.     Write('Your choice: ');
  1451.     REPEAT
  1452.         ReadLn(choice2);
  1453.     UNTIL choice2 IN ['a'..'e','q'];
  1454.     IF choice2 = 'q' THEN Halt;
  1455.  
  1456.     CASE choice2 OF
  1457.         'a' : BEGIN
  1458.             xsize := 320;
  1459.             ysize := 200;
  1460.         END;
  1461.         'b' : BEGIN
  1462.             xsize := 640;
  1463.             ysize := 480;
  1464.         END;
  1465.         'c' : BEGIN
  1466.             xsize := 800;
  1467.             ysize := 600;
  1468.         END;
  1469.         'd' : BEGIN
  1470.             xsize := 1024;
  1471.             ysize := 768;
  1472.         END;
  1473.         'e' : BEGIN
  1474.             xsize := 1280;
  1475.             ysize := 1024;
  1476.         END;
  1477.     END;
  1478.     CASE choice1 OF
  1479.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1480.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1481.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1482.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1483.     END;
  1484.     IF mode = 0 THEN BEGIN
  1485.         WriteLn('No such mode could be found !');
  1486.         WriteLn('Switching to to 320x200.');
  1487.         ReadKey;
  1488.         mode := V320x200x256;
  1489.     END;
  1490. END;
  1491.  
  1492. begin { program body }
  1493.   SelectMode;
  1494.   Initialize;
  1495.   ReportStatus;
  1496.  
  1497. {  AspectRatioPlay; }
  1498.   FillEllipsePlay;
  1499.   SectorPlay;
  1500.   WriteModePlay;
  1501.  
  1502.   ColorPlay;
  1503.   { PalettePlay only intended to work on these drivers: }
  1504.   if (GraphDriver = EGA) or
  1505.       (GraphDriver = EGA64) or
  1506.       (GraphDriver = VGA) then
  1507.      PalettePlay;
  1508.   PutPixelPlay;
  1509. {  PutImagePlay; }
  1510.   RandBarPlay;
  1511.   BarPlay;
  1512.   Bar3DPlay;
  1513.   ArcPlay;
  1514.   CirclePlay;
  1515.   PiePlay;
  1516.   LineToPlay;
  1517.   LineRelPlay;
  1518. {  LineStylePlay; }
  1519. {  UserLineStylePlay; }
  1520.   TextDump;
  1521.   TextPlay;
  1522.   CrtModePlay;
  1523.   FillStylePlay;
  1524.   FillPatternPlay;
  1525.   PolyPlay;
  1526.   SayGoodbye;
  1527. {  CloseGraph; }
  1528.   CloseVesa;
  1529. end.
  1530. ***************************************************
  1531.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1532.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  1533. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  1534. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1535. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1536. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1537.     Color := RandColor;
  1538.     SetColor(Color);
  1539.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1540.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1541.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1542.   until KeyPressed;
  1543.   WaitToGo;
  1544. end; { RandBarPlay }
  1545.  
  1546. procedure ArcPlay;
  1547. { Draw random arcs on the screen }
  1548. var
  1549.   MaxRadius : word;
  1550.   EndAngle : word;
  1551.   ArcInfo : ArcCoordsType;
  1552. begin
  1553.   MainWindow('Arc / GetArcCoords demonstration');
  1554.   StatusLine('Esc aborts or press a key');
  1555.   MaxRadius := MaxY div 10;
  1556.   repeat
  1557.     SetColor(RandColor);
  1558.     EndAngle := Random(360);
  1559.     SetLineStyle(SolidLn, 0, NormWidth);
  1560.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1561.     GetArcCoords(ArcInfo);
  1562.     with ArcInfo do
  1563.     begin
  1564.       Line(X, Y, XStart, YStart);
  1565.       Line(X, Y, Xend, Yend);
  1566.     end;
  1567.   until KeyPressed;
  1568.   WaitToGo;
  1569. end; { ArcPlay }
  1570.  
  1571. procedure PutPixelPlay;
  1572. { Demonstrate the PutPixel and GetPixel commands }
  1573. const
  1574.   Seed   = 1962; { A seed for the random number generator }
  1575.   NumPts = 2000; { The number of pixels plotted }
  1576.   Esc    = #27;
  1577. var
  1578.   I : word;
  1579.   X, Y, Color : word;
  1580.   XMax, YMax  : integer;
  1581.   ViewInfo    : ViewPortType;
  1582. begin
  1583.   MainWindow('PutPixel / GetPixel demonstration');
  1584.   StatusLine('Esc aborts or press a key...');
  1585.  
  1586.   GetViewSettings(ViewInfo);
  1587.   with ViewInfo do
  1588.   begin
  1589.     XMax := (x2-x1-1);
  1590.     YMax := (y2-y1-1);
  1591.   end;
  1592.  
  1593.   while not KeyPressed do
  1594.   begin
  1595.     { Plot random pixels }
  1596.     RandSeed := Seed;
  1597.     I := 0;
  1598.     while (not KeyPressed) and (I < NumPts) do
  1599.     begin
  1600.       Inc(I);
  1601.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1602.     end;
  1603.  
  1604.     { Erase pixels }
  1605.     RandSeed := Seed;
  1606.     I := 0;
  1607.     while (not KeyPressed) and (I < NumPts) do
  1608.     begin
  1609.       Inc(I);
  1610.       X := Random(XMax)+1;
  1611.       Y := Random(YMax)+1;
  1612.       Color := GetPixel(X, Y);
  1613.         if Color = RandColor then
  1614.           PutPixel(X, Y, 0);
  1615.      end;
  1616.   end;
  1617.   WaitToGo;
  1618. end; { PutPixelPlay }
  1619.  
  1620. procedure PutImagePlay;
  1621. { Demonstrate the GetImage and PutImage commands }
  1622.  
  1623. const
  1624.   r  = 20;
  1625.   StartX = 100;
  1626.   StartY = 50;
  1627.  
  1628. var
  1629.   CurPort : ViewPortType;
  1630.  
  1631. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1632. var
  1633.   Step : integer;
  1634. begin
  1635.   Step := Random(2*r);
  1636.   if Odd(Step) then
  1637.     Step := -Step;
  1638.   X := X + Step;
  1639.   Step := Random(r);
  1640.   if Odd(Step) then
  1641.     Step := -Step;
  1642.   Y := Y + Step;
  1643.  
  1644.   { Make saucer bounce off viewport walls }
  1645.   with CurPort do
  1646.   begin
  1647.     if (x1 + X + Width - 1 > x2) then
  1648.       X := x2-x1 - Width + 1
  1649.     else
  1650.       if (X < 0) then
  1651.         X := 0;
  1652.     if (y1 + Y + Height - 1 > y2) then
  1653.       Y := y2-y1 - Height + 1
  1654.     else
  1655.       if (Y < 0) then
  1656.         Y := 0;
  1657.   end;
  1658. end; { MoveSaucer }
  1659.  
  1660. var
  1661.   Pausetime : word;
  1662.   Saucer    : pointer;
  1663.   X, Y      : integer;
  1664.   ulx, uly  : word;
  1665.   lrx, lry  : word;
  1666.   Size      : word;
  1667.   I         : word;
  1668. begin
  1669.   ClearDevice;
  1670.   FullPort;
  1671.  
  1672.   { PaintScreen }
  1673.   ClearDevice;
  1674.   MainWindow('GetImage / PutImage Demonstration');
  1675.   StatusLine('Esc aborts or press a key...');
  1676.   GetViewSettings(CurPort);
  1677.  
  1678.   { DrawSaucer }
  1679.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1680.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1681.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1682.   Circle(StartX+10, StartY-12, 2);
  1683.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1684.   Circle(StartX-10, StartY-12, 2);
  1685.   SetFillStyle(SolidFill, MaxColor);
  1686.   FloodFill(StartX+1, StartY+4, GetColor);
  1687.  
  1688.   { ReadSaucerImage }
  1689.   ulx := StartX-(r+1);
  1690.   uly := StartY-14;
  1691.   lrx := StartX+(r+1);
  1692.   lry := StartY+(r div 3)+3;
  1693.  
  1694.   Size := ImageSize(ulx, uly, lrx, lry);
  1695.   GetMem(Saucer, Size);
  1696.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1697. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1698.  
  1699.   { Plot some "stars" }
  1700.   for I := 1 to 1000 do
  1701.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1702.   X := MaxX div 2;
  1703.   Y := MaxY div 2;
  1704.   PauseTime := 70;
  1705.  
  1706.   { Move the saucer around }
  1707.   repeat
  1708. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1709.      Delay(PauseTime);
  1710. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1711.      Move